package com.gkfreshmart.cloud.api;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Copyright (C),2019-2020),田坊集市数据科技
 * FileName: Result
 * Author: Bruin
 * Date: 2020/10/16 15：00
 * Description: 统一API响应结果
 * History:
 * <author>  <time>  <version>   <desc>
 * 作者姓名  修改时间    版本号     描述
 *
 */
@Data
@NoArgsConstructor
public class Result {
    private int code;
    private String message;
    private Object data;

    public Result(ResultCodeEnum resultCode){
        this.code = resultCode.getCode();
        this.message = resultCode.getMsg();
    }

    public Result setCode(ResultCodeEnum resultCode) {
        this.code = resultCode.getCode();
        return this;
    }

    public Result setCode(Integer code) {
        this.code = code;
        return this;
    }

    public Result setMessage(String message) {
        this.message = message;
        return this;
    }

    public Result setData(Object data) {
        this.data = data;
        return this;
    }

}

